package com.mobimagic.lockscreen.view;

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.View;

import com.mobimagic.lockscreen.Charge;

public class BubbleView extends View {

    Bubbles bubbles;

    private int bottomGap, topGap, peak;

    public BubbleView(Context context, AttributeSet attrs) {
        super(context, attrs);
        bubbles = new Bubbles(this);
        this.peak = LayoutData.getInstance().getPeakHeight();
        bottomGap = peak * 2 + LayoutData.getInstance().getSlidLockHeight();
        topGap = LayoutData.getInstance().getWaveTop();

        bubbles = new Bubbles(this);
        bubbles.setTopGap(topGap);
        bubbles.setBottomGap(bottomGap);
    }

    public void setCharge(Charge charge) {

        bubbles.setCharge(charge);
    }

    public void onStop() {
        bubbles.onStop();
    }

    public void onStart() {
        bubbles.onStart();
    }

    @Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        bubbles.onAttachedToWindow();
    }

    @Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        bubbles.onDetachedFromWindow();
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        bubbles.draw(canvas);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        bubbles.setBounds(getMeasuredWidth(), getMeasuredHeight());
    }

    public void setTopFadeView(TopFadeView topFadeView) {
        // TODO Auto-generated method stub

    }

}
